package com.jd.mti.beetl.test;



import java.util.*;

/**
 * @Author sizegang
 * @Date 2021/11/15 17:57
 * @Version 1.0
 */
public class DataUtil {

    public static Map<String, Object> dataManMap = new HashMap<>();
    public static Map<String, List> openRestyData = new HashMap<>();

    static {
        for(int i =0; i< 126; i++){

            if(i % 2  == 0){
                doData(String.valueOf(i), dataManMap);
            }else{
                List<DataMan> list = new ArrayList<DataMan>();
                DataMan dataMan = new DataMan(i + "的姓名", i);
                dataMan.setA(i + "childDataMan a");
                dataMan.setB(i + "childDataMan b");
                dataMan.setC(i + "childDataMan c");
                dataMan.setD(i + "childDataMan d");
                dataMan.setE(i + "childDataMan e");
                dataMan.setF(i + "childDataMan f");
                dataMan.setG(i + "childDataMan g");
                dataMan.setL(i + "childDataMan l");
                dataMan.setH(i + "childDataMan h");
                dataMan.setK(i + "childDataMan k");
                list.add(dataMan);
                dataManMap.put(String.valueOf(i), list);
            }

            getOpenRestyData();
        }
    }


    public static Map<String, Object> getLo(){
        Map<String, Object> dataManMap = new HashMap<>();
        for(int i =0; i< 1000; i++){

            if(i % 2  == 0){
                doData(String.valueOf(i), dataManMap);
            }else{
                List<DataMan> list = new ArrayList<DataMan>();
                DataMan dataMan = new DataMan(i + "的姓名", i);
                dataMan.setA(i + "childDataMan a");
                dataMan.setB(i + "childDataMan b");
                dataMan.setC(i + "childDataMan c");
                dataMan.setD(i + "childDataMan d");
                dataMan.setE(i + "childDataMan e");
                dataMan.setF(i + "childDataMan f");
                dataMan.setG(i + "childDataMan g");
                dataMan.setL(i + "childDataMan l");
                dataMan.setH(i + "childDataMan h");
                dataMan.setK(i + "childDataMan k");
                list.add(dataMan);
                dataManMap.put(String.valueOf(i), list);
            }
        }
        return dataManMap;
    }


    public static void doData(String index, Map<String, Object> dataManMap){

        List<DataMan> list = new ArrayList<DataMan>();
        for(int i = 0; i< Integer.parseInt(index); i++){
            DataMan dataMan = new DataMan(i + "childDataMan 姓名", i);
            dataMan.setA(i + "childDataMan a");
            dataMan.setB(i + "childDataMan b");
            dataMan.setC(i + "childDataMan c");
            dataMan.setD(i + "childDataMan d");
            dataMan.setE(i + "childDataMan e");
            dataMan.setF(i + "childDataMan f");
            dataMan.setG(i + "childDataMan g");
            dataMan.setL(i + "childDataMan l");
            dataMan.setH(i + "childDataMan h");
            dataMan.setK(i + "childDataMan k");
            list.add(dataMan);
        }
        dataManMap.put(index, list);
    }


    public static Map<String, Object> getLoadData() {
        return getLo();
    }


    public  static void getOpenRestyData(){
        List list = new ArrayList();
        Random random  = new Random();
        for(int i = 0; i< 1000; i++){
            OpenRestyData openRestyData = new OpenRestyData();
            openRestyData.setAge(12);
            openRestyData.setName("gcx");
            list.add(openRestyData);
        }
        openRestyData.put("data", list);
    }
}
